import request from "@/utils/request";
import { AxiosPromise } from "axios";
import { QuestionVO, QuestionQuery, QuestionForm } from "./types";

/**
 * 获取问题分页
 * @param queryParams
 */
export function listQuestion(
  queryParams?: QuestionQuery
): AxiosPromise<MybatisPageResult<QuestionVO>> {
  return request({
    url: "buss/question/list",
    method: "get",
    params: queryParams,
  });
}

/**
 * 获取问题详情
 *
 * @param userId
 */
export function getQuestionForm(id: string): AxiosPromise<QuestionForm> {
  return request({
    url: `buss/question/one/${id}`,
    method: "get",
  });
}

/**
 * 新增
 *
 * @param data
 */
export function saveQuestion(data: QuestionForm) {
  return request({
    url: "buss/question/save",
    method: "post",
    data,
  });
}

/**
 * 删除
 */
export function deleteQuestion(ids: string[]) {
  return request({
    url: "buss/question/del",
    method: "post",
    data: ids,
  });
}
